const app = getApp();
const md = require('./md5.js');
const formid = e => {
  var appid = app.globalData.AppID;
  var appkey = app.globalData.appkey;
  var timestamp = new Date().getTime();
  timestamp = parseInt(timestamp / 1000);
  var formID = '/BO/GB_WXFormID/Add'
  var formIDMd5 = md.hexMD5(appid + timestamp + formID + appkey);
  wx.request({
    url: app.serve.serveUrl + 'BO/GB_WXFormID/Add',
    method: 'POST',
    header: { 'content-type': 'application/x-www-form-urlencoded' },
    data: {
      sign: formIDMd5,
      appid: appid,
      tmsp: timestamp,
      data: JSON.stringify({
        OpenID: app.globalData.messageOS.openid,
        FormID: e.detail.formId
      })
    },
    success: res => {
      console.log(res);
    }
  })
}
module.exports = {
  formid: formid
}